/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.luxoft.corporate.blog.ui;

import com.luxoft.corporate.blog.db.Controller;
import com.luxoft.corporate.blog.db.entities.BlogEntry;
import com.luxoft.corporate.blog.db.entities.User;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
import static javax.swing.Action.SHORT_DESCRIPTION;
import static javax.swing.Action.SMALL_ICON;
import javax.swing.ImageIcon;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;

/**
 *
 * @author Egor
 */
public class MainPanel extends JPanel {

    private JMenuBar menuBar;
    private List<BlogEntryPanel> blogEntryPanels;
    private Controller<BlogEntry> controller;
    private User user;

    public MainPanel() {
        menuBar = new JMenuBar();
        init();
    }

    private void init() {
        setLayout(new BorderLayout(5, 5));
        add(menuBar, BorderLayout.NORTH);

    }

    public void addMenuToBar(Action menuAction, JMenuItem... menuItems) {
        JMenu menu = new JMenu(menuAction);
        if (menuItems != null) {
            for (JMenuItem menuItem : menuItems) {
                menu.add(menuItem);
            }
        }
        menuBar.add(menu);
    }

    public static class AddAction extends AbstractAction {

        public AddAction() {
            putValue(SHORT_DESCRIPTION, "Add record to blogs");
            putValue(SMALL_ICON, new ImageIcon(getClass().getClassLoader().getResource("com/luxoft/corporate/blog/resources/img/add_icon.png")));

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

    }

    public static class SearchAction extends AbstractAction {

        public SearchAction() {
            putValue(SHORT_DESCRIPTION, "Search records");
            putValue(SMALL_ICON, new ImageIcon(getClass().getClassLoader().getResource("com/luxoft/corporate/blog/resources/img/search_icon.png")));

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

    }

    public static class AccountAction extends AbstractAction {

        public AccountAction() {
            putValue(SHORT_DESCRIPTION, "Manage your accaount");
            putValue(SMALL_ICON, new ImageIcon(getClass().getClassLoader().getResource("com/luxoft/corporate/blog/resources/img/account_icon.png")));

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

    }

    public static class LogOutAction extends AbstractAction {

        public LogOutAction() {
            putValue(SHORT_DESCRIPTION, "Exit from application");
            putValue(SMALL_ICON, new ImageIcon(getClass().getClassLoader().getResource("com/luxoft/corporate/blog/resources/img/logout_icon.png")));
            
        }

        
        public LogOutAction(String text) {
            this();
            putValue(NAME, text);
        }
       
        @Override
        public void actionPerformed(ActionEvent e) {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        
        
    }

}
